package pers.gxm.iterator;

import java.util.Iterator;

public class Book {
    public static void main(String[] args) {
        Book hlm = new Book("hlm");
        Book sgyy = new Book("sgyy");
        Book shz = new Book("shz");
        Book xyj = new Book("xyj");
        BookShelf books = new BookShelf();
        books.appendBook(hlm);
        books.appendBook(sgyy);
        books.appendBook(shz);
        books.appendBook(xyj);
        Iterator<Book> iterator = books.iterator();
        while(iterator.hasNext()){
            Book book = iterator.next();
            System.out.println("book = " + book);
        }
    }
    private String name;
    public Book(String name){
        this.name = name;
    }
    public String getName(){
        return name;
    }

    @Override
    public String toString() {
        return "Book{" +
                "name='" + name + '\'' +
                '}';
    }
}
